//
//  ViewController.m
//  ScreenRotateVC
//
//  Created by Liusr on 2017/6/6.
//  Copyright © 2017年 liu. All rights reserved.
//

#import "ViewController.h"
#import "FirstView.h"
#import "FirstViewController.h"
@interface ViewController ()

@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    FirstView *fview = [[FirstView alloc]init];
    fview.frame = CGRectMake(50, 50, 200, 100);
    [self.view addSubview:fview];
    
    
    UIButton *bu = [[UIButton alloc]initWithFrame:CGRectMake(50, 200, 80, 50)];
    [bu setTitle:@"present" forState:UIControlStateNormal];
    [bu setTitleColor:[UIColor redColor] forState:UIControlStateNormal];
    [self.view addSubview:bu];
    [bu addTarget:self action:@selector(click) forControlEvents:UIControlEventTouchUpInside];
    // Do any additional setup after loading the view, typically from a nib.
}
-(void)click{
    FirstViewController *fvc = [[FirstViewController alloc]init];
    [self presentViewController:fvc animated:YES completion:nil];
}

-(BOOL)shouldAutorotate{
    return YES;
}
//工程根视图是导航的情况
//推出fvc后是横屏，用户就会转过来看，一旦转过来
//这里就会转，fvc dismiss后 这里就横着了。。所以导航要控制下，根据top判断
-(UIInterfaceOrientationMask)supportedInterfaceOrientations{
    return UIInterfaceOrientationMaskPortrait;
}


- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}


@end
